\(\int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx\) [75]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 116 \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=-\frac {\cot (c+d x)}{a^4 d}-\frac {4 b \log (\tan (c+d x))}{a^5 d}+\frac {4 b \log (a+b \tan (c+d x))}{a^5 d}-\frac {b}{3 a^2 d (a+b \tan (c+d x))^3}-\frac {b}{a^3 d (a+b \tan (c+d x))^2}-\frac {3 b}{a^4 d (a+b \tan (c+d x))} \]

[Out]

-cot(d*x+c)/a^4/d-4*b*ln(tan(d*x+c))/a^5/d+4*b*ln(a+b*tan(d*x+c))/a^5/d-1/3*b/a^2/d/(a+b*tan(d*x+c))^3-b/a^3/d
/(a+b*tan(d*x+c))^2-3*b/a^4/d/(a+b*tan(d*x+c))

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3597, 46} \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=-\frac {4 b \log (\tan (c+d x))}{a^5 d}+\frac {4 b \log (a+b \tan (c+d x))}{a^5 d}-\frac {3 b}{a^4 d (a+b \tan (c+d x))}-\frac {\cot (c+d x)}{a^4 d}-\frac {b}{a^3 d (a+b \tan (c+d x))^2}-\frac {b}{3 a^2 d (a+b \tan (c+d x))^3} \]

[In]

Int[Csc[c + d*x]^2/(a + b*Tan[c + d*x])^4,x]

[Out]

-(Cot[c + d*x]/(a^4*d)) - (4*b*Log[Tan[c + d*x]])/(a^5*d) + (4*b*Log[a + b*Tan[c + d*x]])/(a^5*d) - b/(3*a^2*d
*(a + b*Tan[c + d*x])^3) - b/(a^3*d*(a + b*Tan[c + d*x])^2) - (3*b)/(a^4*d*(a + b*Tan[c + d*x]))

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 3597

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[b/f, Subst[Int
[x^m*((a + x)^n/(b^2 + x^2)^(m/2 + 1)), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/
2]

Rubi steps \begin{align*} \text {integral}& = \frac {b \text {Subst}\left (\int \frac {1}{x^2 (a+x)^4} \, dx,x,b \tan (c+d x)\right )}{d} \\ & = \frac {b \text {Subst}\left (\int \left (\frac {1}{a^4 x^2}-\frac {4}{a^5 x}+\frac {1}{a^2 (a+x)^4}+\frac {2}{a^3 (a+x)^3}+\frac {3}{a^4 (a+x)^2}+\frac {4}{a^5 (a+x)}\right ) \, dx,x,b \tan (c+d x)\right )}{d} \\ & = -\frac {\cot (c+d x)}{a^4 d}-\frac {4 b \log (\tan (c+d x))}{a^5 d}+\frac {4 b \log (a+b \tan (c+d x))}{a^5 d}-\frac {b}{3 a^2 d (a+b \tan (c+d x))^3}-\frac {b}{a^3 d (a+b \tan (c+d x))^2}-\frac {3 b}{a^4 d (a+b \tan (c+d x))} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(259\) vs. \(2(116)=232\).

Time = 3.28 (sec) , antiderivative size = 259, normalized size of antiderivative = 2.23 \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=\frac {\sec ^3(c+d x) (a \cos (c+d x)+b \sin (c+d x)) \left (-3 a (b+a \cot (c+d x))^3 \sin ^2(c+d x)+\frac {a^2 b^4 \tan (c+d x)}{a^2+b^2}+\frac {b^2 \left (18 a^4+23 a^2 b^2+9 b^4\right ) (a \cos (c+d x)+b \sin (c+d x))^2 \tan (c+d x)}{\left (a^2+b^2\right )^2}-\frac {2 a^2 b^3 \left (3 a^2+2 b^2\right ) (a+b \tan (c+d x))}{\left (a^2+b^2\right )^2}-12 b \cos ^2(c+d x) \log (\sin (c+d x)) (a+b \tan (c+d x))^3+12 b \cos ^2(c+d x) \log (a \cos (c+d x)+b \sin (c+d x)) (a+b \tan (c+d x))^3\right )}{3 a^5 d (a+b \tan (c+d x))^4} \]

[In]

Integrate[Csc[c + d*x]^2/(a + b*Tan[c + d*x])^4,x]

[Out]

(Sec[c + d*x]^3*(a*Cos[c + d*x] + b*Sin[c + d*x])*(-3*a*(b + a*Cot[c + d*x])^3*Sin[c + d*x]^2 + (a^2*b^4*Tan[c
 + d*x])/(a^2 + b^2) + (b^2*(18*a^4 + 23*a^2*b^2 + 9*b^4)*(a*Cos[c + d*x] + b*Sin[c + d*x])^2*Tan[c + d*x])/(a
^2 + b^2)^2 - (2*a^2*b^3*(3*a^2 + 2*b^2)*(a + b*Tan[c + d*x]))/(a^2 + b^2)^2 - 12*b*Cos[c + d*x]^2*Log[Sin[c +
 d*x]]*(a + b*Tan[c + d*x])^3 + 12*b*Cos[c + d*x]^2*Log[a*Cos[c + d*x] + b*Sin[c + d*x]]*(a + b*Tan[c + d*x])^
3))/(3*a^5*d*(a + b*Tan[c + d*x])^4)

Maple [A] (verified)

Time = 2.24 (sec) , antiderivative size = 103, normalized size of antiderivative = 0.89

method result size
derivativedivides \(\frac {-\frac {1}{a^{4} \tan \left (d x +c \right )}-\frac {4 b \ln \left (\tan \left (d x +c \right )\right )}{a^{5}}-\frac {b}{3 a^{2} \left (a +b \tan \left (d x +c \right )\right )^{3}}+\frac {4 b \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{5}}-\frac {3 b}{a^{4} \left (a +b \tan \left (d x +c \right )\right )}-\frac {b}{a^{3} \left (a +b \tan \left (d x +c \right )\right )^{2}}}{d}\) \(103\)
default \(\frac {-\frac {1}{a^{4} \tan \left (d x +c \right )}-\frac {4 b \ln \left (\tan \left (d x +c \right )\right )}{a^{5}}-\frac {b}{3 a^{2} \left (a +b \tan \left (d x +c \right )\right )^{3}}+\frac {4 b \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{5}}-\frac {3 b}{a^{4} \left (a +b \tan \left (d x +c \right )\right )}-\frac {b}{a^{3} \left (a +b \tan \left (d x +c \right )\right )^{2}}}{d}\) \(103\)
risch \(-\frac {2 i \left (96 i a^{3} b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+36 i a^{5} b \,{\mathrm e}^{4 i \left (d x +c \right )}-120 i a \,b^{5} {\mathrm e}^{4 i \left (d x +c \right )}-3 a^{6} {\mathrm e}^{6 i \left (d x +c \right )}+63 a^{4} b^{2} {\mathrm e}^{6 i \left (d x +c \right )}-120 a^{2} b^{4} {\mathrm e}^{6 i \left (d x +c \right )}+12 b^{6} {\mathrm e}^{6 i \left (d x +c \right )}+18 i a^{5} b \,{\mathrm e}^{6 i \left (d x +c \right )}+18 i a^{5} b \,{\mathrm e}^{2 i \left (d x +c \right )}-9 a^{6} {\mathrm e}^{4 i \left (d x +c \right )}+63 a^{4} b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+120 a^{2} b^{4} {\mathrm e}^{4 i \left (d x +c \right )}-36 b^{6} {\mathrm e}^{4 i \left (d x +c \right )}+60 i a \,b^{5} {\mathrm e}^{2 i \left (d x +c \right )}+60 i a \,b^{5} {\mathrm e}^{6 i \left (d x +c \right )}-120 i a^{3} b^{3} {\mathrm e}^{6 i \left (d x +c \right )}-9 a^{6} {\mathrm e}^{2 i \left (d x +c \right )}-27 a^{4} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+32 a^{2} b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+36 b^{6} {\mathrm e}^{2 i \left (d x +c \right )}-3 a^{6}-27 a^{4} b^{2}-32 a^{2} b^{4}-12 b^{6}\right )}{3 \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+i a \,{\mathrm e}^{2 i \left (d x +c \right )}-b +i a \right )^{3} \left (i a +b \right )^{3} a^{4} d}-\frac {4 b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{a^{5} d}+\frac {4 b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{a^{5} d}\) \(470\)

[In]

int(csc(d*x+c)^2/(a+b*tan(d*x+c))^4,x,method=_RETURNVERBOSE)

[Out]

1/d*(-1/a^4/tan(d*x+c)-4/a^5*b*ln(tan(d*x+c))-1/3/a^2*b/(a+b*tan(d*x+c))^3+4/a^5*b*ln(a+b*tan(d*x+c))-3/a^4*b/
(a+b*tan(d*x+c))-1/a^3*b/(a+b*tan(d*x+c))^2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 874 vs. \(2 (114) = 228\).

Time = 0.30 (sec) , antiderivative size = 874, normalized size of antiderivative = 7.53 \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=-\frac {13 \, a^{6} b^{4} + 15 \, a^{4} b^{6} + 6 \, a^{2} b^{8} - {\left (3 \, a^{10} + 18 \, a^{8} b^{2} - 49 \, a^{6} b^{4} - 84 \, a^{4} b^{6} - 36 \, a^{2} b^{8}\right )} \cos \left (d x + c\right )^{4} + {\left (9 \, a^{8} b^{2} - 71 \, a^{6} b^{4} - 102 \, a^{4} b^{6} - 42 \, a^{2} b^{8}\right )} \cos \left (d x + c\right )^{2} + 6 \, {\left (a^{6} b^{4} + 3 \, a^{4} b^{6} + 3 \, a^{2} b^{8} + b^{10} - {\left (3 \, a^{8} b^{2} + 8 \, a^{6} b^{4} + 6 \, a^{4} b^{6} - b^{10}\right )} \cos \left (d x + c\right )^{4} + {\left (3 \, a^{8} b^{2} + 7 \, a^{6} b^{4} + 3 \, a^{4} b^{6} - 3 \, a^{2} b^{8} - 2 \, b^{10}\right )} \cos \left (d x + c\right )^{2} + {\left ({\left (a^{9} b - 6 \, a^{5} b^{5} - 8 \, a^{3} b^{7} - 3 \, a b^{9}\right )} \cos \left (d x + c\right )^{3} + 3 \, {\left (a^{7} b^{3} + 3 \, a^{5} b^{5} + 3 \, a^{3} b^{7} + a b^{9}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )\right )} \log \left (2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}\right ) - 6 \, {\left (a^{6} b^{4} + 3 \, a^{4} b^{6} + 3 \, a^{2} b^{8} + b^{10} - {\left (3 \, a^{8} b^{2} + 8 \, a^{6} b^{4} + 6 \, a^{4} b^{6} - b^{10}\right )} \cos \left (d x + c\right )^{4} + {\left (3 \, a^{8} b^{2} + 7 \, a^{6} b^{4} + 3 \, a^{4} b^{6} - 3 \, a^{2} b^{8} - 2 \, b^{10}\right )} \cos \left (d x + c\right )^{2} + {\left ({\left (a^{9} b - 6 \, a^{5} b^{5} - 8 \, a^{3} b^{7} - 3 \, a b^{9}\right )} \cos \left (d x + c\right )^{3} + 3 \, {\left (a^{7} b^{3} + 3 \, a^{5} b^{5} + 3 \, a^{3} b^{7} + a b^{9}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )\right )} \log \left (-\frac {1}{4} \, \cos \left (d x + c\right )^{2} + \frac {1}{4}\right ) - {\left ({\left (9 \, a^{9} b + 78 \, a^{7} b^{3} + 69 \, a^{5} b^{5} + 4 \, a^{3} b^{7} - 12 \, a b^{9}\right )} \cos \left (d x + c\right )^{3} - 3 \, {\left (9 \, a^{7} b^{3} + 3 \, a^{5} b^{5} - 6 \, a^{3} b^{7} - 4 \, a b^{9}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{3 \, {\left ({\left (3 \, a^{13} b + 8 \, a^{11} b^{3} + 6 \, a^{9} b^{5} - a^{5} b^{9}\right )} d \cos \left (d x + c\right )^{4} - {\left (3 \, a^{13} b + 7 \, a^{11} b^{3} + 3 \, a^{9} b^{5} - 3 \, a^{7} b^{7} - 2 \, a^{5} b^{9}\right )} d \cos \left (d x + c\right )^{2} - {\left (a^{11} b^{3} + 3 \, a^{9} b^{5} + 3 \, a^{7} b^{7} + a^{5} b^{9}\right )} d - {\left ({\left (a^{14} - 6 \, a^{10} b^{4} - 8 \, a^{8} b^{6} - 3 \, a^{6} b^{8}\right )} d \cos \left (d x + c\right )^{3} + 3 \, {\left (a^{12} b^{2} + 3 \, a^{10} b^{4} + 3 \, a^{8} b^{6} + a^{6} b^{8}\right )} d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )\right )}} \]

[In]

integrate(csc(d*x+c)^2/(a+b*tan(d*x+c))^4,x, algorithm="fricas")

[Out]

-1/3*(13*a^6*b^4 + 15*a^4*b^6 + 6*a^2*b^8 - (3*a^10 + 18*a^8*b^2 - 49*a^6*b^4 - 84*a^4*b^6 - 36*a^2*b^8)*cos(d
*x + c)^4 + (9*a^8*b^2 - 71*a^6*b^4 - 102*a^4*b^6 - 42*a^2*b^8)*cos(d*x + c)^2 + 6*(a^6*b^4 + 3*a^4*b^6 + 3*a^
2*b^8 + b^10 - (3*a^8*b^2 + 8*a^6*b^4 + 6*a^4*b^6 - b^10)*cos(d*x + c)^4 + (3*a^8*b^2 + 7*a^6*b^4 + 3*a^4*b^6
- 3*a^2*b^8 - 2*b^10)*cos(d*x + c)^2 + ((a^9*b - 6*a^5*b^5 - 8*a^3*b^7 - 3*a*b^9)*cos(d*x + c)^3 + 3*(a^7*b^3
+ 3*a^5*b^5 + 3*a^3*b^7 + a*b^9)*cos(d*x + c))*sin(d*x + c))*log(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)
*cos(d*x + c)^2 + b^2) - 6*(a^6*b^4 + 3*a^4*b^6 + 3*a^2*b^8 + b^10 - (3*a^8*b^2 + 8*a^6*b^4 + 6*a^4*b^6 - b^10
)*cos(d*x + c)^4 + (3*a^8*b^2 + 7*a^6*b^4 + 3*a^4*b^6 - 3*a^2*b^8 - 2*b^10)*cos(d*x + c)^2 + ((a^9*b - 6*a^5*b
^5 - 8*a^3*b^7 - 3*a*b^9)*cos(d*x + c)^3 + 3*(a^7*b^3 + 3*a^5*b^5 + 3*a^3*b^7 + a*b^9)*cos(d*x + c))*sin(d*x +
 c))*log(-1/4*cos(d*x + c)^2 + 1/4) - ((9*a^9*b + 78*a^7*b^3 + 69*a^5*b^5 + 4*a^3*b^7 - 12*a*b^9)*cos(d*x + c)
^3 - 3*(9*a^7*b^3 + 3*a^5*b^5 - 6*a^3*b^7 - 4*a*b^9)*cos(d*x + c))*sin(d*x + c))/((3*a^13*b + 8*a^11*b^3 + 6*a
^9*b^5 - a^5*b^9)*d*cos(d*x + c)^4 - (3*a^13*b + 7*a^11*b^3 + 3*a^9*b^5 - 3*a^7*b^7 - 2*a^5*b^9)*d*cos(d*x + c
)^2 - (a^11*b^3 + 3*a^9*b^5 + 3*a^7*b^7 + a^5*b^9)*d - ((a^14 - 6*a^10*b^4 - 8*a^8*b^6 - 3*a^6*b^8)*d*cos(d*x
+ c)^3 + 3*(a^12*b^2 + 3*a^10*b^4 + 3*a^8*b^6 + a^6*b^8)*d*cos(d*x + c))*sin(d*x + c))

Sympy [F]

\[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=\int \frac {\csc ^{2}{\left (c + d x \right )}}{\left (a + b \tan {\left (c + d x \right )}\right )^{4}}\, dx \]

[In]

integrate(csc(d*x+c)**2/(a+b*tan(d*x+c))**4,x)

[Out]

Integral(csc(c + d*x)**2/(a + b*tan(c + d*x))**4, x)

Maxima [A] (verification not implemented)

none

Time = 0.39 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.21 \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=-\frac {\frac {12 \, b^{3} \tan \left (d x + c\right )^{3} + 30 \, a b^{2} \tan \left (d x + c\right )^{2} + 22 \, a^{2} b \tan \left (d x + c\right ) + 3 \, a^{3}}{a^{4} b^{3} \tan \left (d x + c\right )^{4} + 3 \, a^{5} b^{2} \tan \left (d x + c\right )^{3} + 3 \, a^{6} b \tan \left (d x + c\right )^{2} + a^{7} \tan \left (d x + c\right )} - \frac {12 \, b \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{5}} + \frac {12 \, b \log \left (\tan \left (d x + c\right )\right )}{a^{5}}}{3 \, d} \]

[In]

integrate(csc(d*x+c)^2/(a+b*tan(d*x+c))^4,x, algorithm="maxima")

[Out]

-1/3*((12*b^3*tan(d*x + c)^3 + 30*a*b^2*tan(d*x + c)^2 + 22*a^2*b*tan(d*x + c) + 3*a^3)/(a^4*b^3*tan(d*x + c)^
4 + 3*a^5*b^2*tan(d*x + c)^3 + 3*a^6*b*tan(d*x + c)^2 + a^7*tan(d*x + c)) - 12*b*log(b*tan(d*x + c) + a)/a^5 +
 12*b*log(tan(d*x + c))/a^5)/d

Giac [A] (verification not implemented)

none

Time = 0.67 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.11 \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=\frac {\frac {12 \, b \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{5}} - \frac {12 \, b \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a^{5}} + \frac {3 \, {\left (4 \, b \tan \left (d x + c\right ) - a\right )}}{a^{5} \tan \left (d x + c\right )} - \frac {22 \, b^{4} \tan \left (d x + c\right )^{3} + 75 \, a b^{3} \tan \left (d x + c\right )^{2} + 87 \, a^{2} b^{2} \tan \left (d x + c\right ) + 35 \, a^{3} b}{{\left (b \tan \left (d x + c\right ) + a\right )}^{3} a^{5}}}{3 \, d} \]

[In]

integrate(csc(d*x+c)^2/(a+b*tan(d*x+c))^4,x, algorithm="giac")

[Out]

1/3*(12*b*log(abs(b*tan(d*x + c) + a))/a^5 - 12*b*log(abs(tan(d*x + c)))/a^5 + 3*(4*b*tan(d*x + c) - a)/(a^5*t
an(d*x + c)) - (22*b^4*tan(d*x + c)^3 + 75*a*b^3*tan(d*x + c)^2 + 87*a^2*b^2*tan(d*x + c) + 35*a^3*b)/((b*tan(
d*x + c) + a)^3*a^5))/d

Mupad [B] (verification not implemented)

Time = 5.32 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.13 \[ \int \frac {\csc ^2(c+d x)}{(a+b \tan (c+d x))^4} \, dx=\frac {8\,b\,\mathrm {atanh}\left (\frac {2\,b\,\mathrm {tan}\left (c+d\,x\right )}{a}+1\right )}{a^5\,d}-\frac {\frac {1}{a}+\frac {10\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{a^3}+\frac {4\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^3}{a^4}+\frac {22\,b\,\mathrm {tan}\left (c+d\,x\right )}{3\,a^2}}{d\,\left (a^3\,\mathrm {tan}\left (c+d\,x\right )+3\,a^2\,b\,{\mathrm {tan}\left (c+d\,x\right )}^2+3\,a\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^3+b^3\,{\mathrm {tan}\left (c+d\,x\right )}^4\right )} \]

[In]

int(1/(sin(c + d*x)^2*(a + b*tan(c + d*x))^4),x)

[Out]

(8*b*atanh((2*b*tan(c + d*x))/a + 1))/(a^5*d) - (1/a + (10*b^2*tan(c + d*x)^2)/a^3 + (4*b^3*tan(c + d*x)^3)/a^
4 + (22*b*tan(c + d*x))/(3*a^2))/(d*(a^3*tan(c + d*x) + b^3*tan(c + d*x)^4 + 3*a^2*b*tan(c + d*x)^2 + 3*a*b^2*
tan(c + d*x)^3))